-- card: 11574 from stack: in.1 -- bmap block id: 0 -- flags: 4000 -- background id: 3837 -- name: RenameFile -- part 1 (button) -- low flags: 00 -- high flags: A003 -- rect: left=82 top=302 right=324 bottom=182 -- title width / last selected line: 0 -- icon id / first selected line: 0 / 0 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Install ----- HyperTalk script ----- on mouseUp if the optionkey is down then pass mouseup put installres(XFCN,RenameFile) into it if it is empty then play oops else answer it end mouseUp -- part 2 (button) -- low flags: 00 -- high flags: A004 -- rect: left=224 top=242 right=293 bottom=283 -- title width / last selected line: 0 -- icon id / first selected line: 27056 / 27056 -- text alignment: 1 -- font id: 0 -- text size: 12 -- style flags: 0 -- line height: 16 -- part name: Try It ----- HyperTalk script ----- -- --12/15/87 •••Steve Drazga••• -- --This script needs XFCNs 'FilenName' and 'RenameFile' --It also needs the Hypertalk function 'LastPathComponent' --It also needs the Hypertalk subroutine 'OsErr' -- on mouseUp if the optionkey is down then pass mouseup put "Please select a file to rename" put filename() into renamethis if renamethis is empty then hide message window play oops exit mouseup end if hide message window put LastPathComponent(renamethis) into shortname ask "What do you want to name this file" with shortname if it is shortname or it is empty then hide message window play oops exit mouseup end if put RenameFile(renamethis,it) into returnedthis if returnedthis = 0 then answer "Everything went just fine" else if returnedthis < 0 then OsErr returnedthis else play oops answer "Whoops, there was an error" end if end if end mouseUp -- part contents for background part 5 ----- text ----- RenameFile -- part contents for background part 10 ----- text ----- 8 -- part contents for background part 6 ----- text ----- This will change the name of a file. Thanks to: Dewi Williams 2227 Juniper Court Boulder CO 80302 (303) 443 9038 Delphi: DEWI -- part contents for background part 7 ----- text ----- Syntax: RenameFile ("OldName", "NewName") "OldName" is a full pathname of the file that you want to rename. "NewName" is a replacement for the last component of the path. Do not put quotation marks around "OldName" and "NewName" The result will contain either 0 (meaning a successful operation), 1 (meaning a parameter error), or a negative number (representing an operating system error). You can use the 'OsErr' function provided in the script of this stack to interpret operating system errors.